package com.jiangruan.javaApiProject.service;

import com.alibaba.fastjson.JSONObject;
import com.jiangruan.javaApiProject.Constants;
import com.jiangruan.javaApiProject.bean.bean.GamePerson;
import com.jiangruan.javaApiProject.bean.bean.GamePersonCommon;
import com.jiangruan.javaApiProject.net.HttpUtils;

import java.util.List;

/**
 * @Author 默
 * @Date 20:46 2021/12/6
 * @desc
 * @Description
 */
public class GamePersonService {

        public static List<GamePerson> getGamePerson() {
            String url = Constants.TRIP_URL
                    + "?key=" + Constants.TRIP_KEY
                    + "&type=game_console"
                    + "&size=0";

            String result = HttpUtils.get(url);

            //对游戏达人榜进行JSON
            GamePersonCommon gamePersonCommon = JSONObject.parseObject(result, GamePersonCommon.class);

            return gamePersonCommon.result;

        }
}
